#!/usr/bin/env python
# -*- coding:utf-8 -*-

class Person:
    type = '人类'
    def __init__(self, name=None, age=None):
        self.name = name
        self.age = age
    def intro(self):
        print("My name is {name}, {age} year old!".format(**self.__dict__))


p = Person('Gateray Zhou', 32)
p.intro()
#绑定静态方法
@staticmethod
def print_type():
    print(Person.type)
Person.print_type = print_type
p.print_type()

#绑定类方法
@classmethod
def print_type_with_sth(cls, sth):
    print(cls.type, sth)
Person.print_type_with_sth = print_type_with_sth
p.print_type_with_sth('666')

#绑定实例方法
def print_name(self):
    print(self.name)
# Person.print_name = print_name
import types
p.print_name = types.MethodType(print_name, p)
p.print_name()


